MainForm = RaisingLight.Framework.Controls.Page.extend(
{
    constructor: function(canvas)
    {
        this.base(canvas);
        this.InitializeComponent();
    },
    InitializeComponent: function()
    {
        /*
         this.button1 = new RaisingLight.Framework.Controls.Button('hello');
         this.button1.addEvent('click', function(sender, e)
         {
         	this.button1.Text = 'world'
         });
         
         this.Elements.push(this.button1);
         */
        var pen = new RaisingLight.Framework.Pen('#00f', '#f00', 4);
        this.line1 = new RaisingLight.Framework.Shapes.Line();
        this.line1.Pen = pen;
        this.line1.X1 = 10;
        this.line1.Y1 = 10;
        this.line1.X2 = 100;
        this.line1.Y2 = 100;
        this.Elements.push(this.line1);
        
        this.rectangle1 = new RaisingLight.Framework.Shapes.Rectangle();
        this.rectangle1.Pen = pen;
        this.rectangle1.Location = new RaisingLight.Framework.Point(15, 20);
        this.rectangle1.Size = new RaisingLight.Framework.Size(150, 100);
        this.Elements.push(this.rectangle1);
        
        this.rectangle2 = new RaisingLight.Framework.Shapes.Rectangle();
        this.rectangle2.Location = new RaisingLight.Framework.Point(35, 30);
        this.rectangle2.Size = new RaisingLight.Framework.Size(250, 200);
        this.Elements.push(this.rectangle2);      
		
        this.button1 = new RaisingLight.Framework.Controls.Button();
        this.button1.Text = "button1";
        this.button1.Location = new RaisingLight.Framework.Point(55, 60);
        this.button1.Size =  new RaisingLight.Framework.Size(75, 21);
		
		this.button1.MouseDown.push(this.button1_MouseDown)
		
        this.Elements.push(this.button1);	  
    },
	
	button1_MouseDown: function(sender, e)	
	{
		alert(sender);
	}
});

function init()
{
    var canvas = document.getElementById('mainform');
    var mainForm = new MainForm(canvas);
    mainForm.Show();
}
